<template>
  <div id="app">
    <header>
      <span></span>
      <input type="text">
    </header>
    <main>
      <TabTitle :list="list" :activeIndex="activeIndex"></TabTitle>
      <Tabbody :children="list[activeIndex].children" />
    </main>
  </div>
</template>

<script>
import TabTitle from "./components/TabTitle";
import Tabbody from "./components/Tabbody";
import Mock from "mockjs";
const data = Mock.mock({
  "list|10": [
    {
      title: "@ctitle(2)",
      "children|10": [
        {
          img: "@image(100x100,@color)",
          name: "@cname",
        },
      ],
    },
  ],
});
export default {
  name: "App",
  components: {
    TabTitle,
    Tabbody,
  },
  data() {
    return {
      list: data.list,
      activeIndex: 0,
    };
  },
  mounted() {
    this.bus.$on("changeActive", (index) => {
      this.activeIndex = index;
    });
  },
};
</script>

<style>
* {
  margin: 0;
  padding: 0;
  list-style: none;
  box-sizing: border-box;
}
html,
body,
#app {
  width: 100%;
  height: 100%;
}
header {
  width: 100%;
  height: 60px;
}
main {
  width: 100px;
}

.le{
  width: 80px;
  height: 100%;
  /* background: pink; */
  float: left;
}
.le ul{
  width: 100%;
  height: 100%;
}
.le ul li{
  width: 100%;
  height: 45px;
  text-align: center;
  line-height: 45px;
}
.rt{
  width: calc(100% - 80px);
  height: auto;
  float: left;
  display: flex;
  flex-wrap: wrap;
}
</style>

